﻿
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../layui/css/layui.css" media="all">
<link rel="stylesheet" href="css/myCss.css">
<script src="../layui/layui.js" charset="utf-8"></script>
<script src="js/jquery-1.12.4.js" type="text/javascript"></script>
<script type="text/javascript">
    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
        if (r != null) return unescape(r[2]); return null; //返回参数值
    }
    //获取图片真实宽高
    function getImageWidth(url, callback) {
        var img = new Image();
        img.src = url;

        // 如果图片被缓存，则直接返回缓存数据
        if (img.complete) {
            callback(img.width, img.height);
        } else {
            // 完全加载完毕的事件
            img.onload = function () {
                callback(img.width, img.height);
            }
        }
    }
</script>
    <link rel="stylesheet" type="text/css" href="css/jquery.dataTables.css">
    <script type="text/javascript" charset="utf8" src="js/jquery.dataTables.js"></script>
 
    <script type="text/javascript">
        //删除数据的地址
        var dizhi = "G_recruitmentList.html?id=";
        //排序字段
        var paixu = "0";
        
    </script>
    <link rel="stylesheet" type="text/css" href="css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="js/jquery.dataTables.js"></script>
<script type="text/javascript">
    $(document).ready(function () {

        var table = $('#example').DataTable({
            "dom": '<"top"f>rt<"bottom"ip><"clear">'
               , "displayLength": 16
               , "order": [[paixu, "desc"]]//列的默认排序 0开始 asc(升序)或desc(降序)
               , stateSave: true//可以保存最后一次分页信息
                            , "language": {//语言国际化
                                "lengthMenu": "每页 _MENU_ 条记录"
                                        , "zeroRecords": "没有找到记录"
                                        , "info": "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )"
                                        , "infoEmpty": "无记录"
                                        , "infoFiltered": "(从 _MAX_ 条记录过滤)"
                                        , "search": "搜索:"
                                        , "paginate": {
                                            "next": "下一页",
                                            "previous": "上一页"
                                        }
                            }
        });

        //多选
        $('#example tbody').on('click', 'tr', function () {
            $(this).toggleClass('selected');
        });

        //全选
        $('#myCheck').on('click', function () {
            $("#example tr").toggleClass('selected');
        });

        //分页、搜索、排序清空选择
        $('#example').on('order.dt',
            function () {
                $("#example tr").removeClass('selected');
            }).on('search.dt',
            function () {
                $("#example tr").removeClass('selected');
            }).on('page.dt',
            function () {
                $("#example tr").removeClass('selected');
            }).dataTable();

        //删除选中项
        $('#deleteRow').on('click', function () {
            if ($('#example tbody tr.selected').length == 0) {
                parent.layer.msg("请选择要删除的行！");
            } else {
                var delIds = "";
                $('#example tbody tr.selected').each(function () {
                    delIds += $(this).attr("id") + ",";
                });
                if (delIds != "") {
                    delIds = delIds.substring(0, delIds.length - 1);
                }
                if (delIds == "undefined") {
                    parent.layer.msg("请选择要删除的行！");
                    return;
                }
                var index = parent.layer.confirm('你确定要删除吗？', {
                    btn: ['删除', '我再想想'] //按钮
                }, function () {
                    parent.layer.close(index);
                    location.href = dizhi + delIds + '&action=del';
                    table.rows('.selected').remove().draw(false);
                }, function () {
                    parent.layer.close(index);
                });

            }
        });

    });
</script>
</head>
<body>
<a href="G_recruitmentAdd.html" class="layui-btn layui-btn-small "><i class="layui-icon">&#xe608;</i> 添加 - 在线招聘 </a>
<a class='layui-btn layui-btn-small layui-btn-normal' id="myCheck"><i class="layui-icon">&#x1005;</i> 全选/反选</a>
<a class='layui-btn layui-btn-small layui-btn-danger' id="deleteRow"><i class="layui-icon">&#xe640;</i> 删除选中的行</a>
    <table id="example" class="display" style="font-size: 11px;" cellspacing="0" width="100%">
        <thead>
            <tr>
            <th>
                    发布时间
                </th>
                <th>
                    职位名称
                </th>
                <th>
                    招聘人数
                </th>
                <th>
                    工资待遇
                </th>
                <th>
                    有效期限
                </th>
                
                <th>
                    操作
                </th>
            </tr>
        </thead>
        <tbody>
          
            <tr id="1">
            <td>
                   2017-7-7
                </td>
                <td>
                    程序员
                </td>
                <td>
                    2
                </td>
                <td>
                    8000
                </td>
                <td>
                    2018
                </td>
                
                <td>
                    <a class='layui-btn layui-btn-mini ' href="G_recruitmentAdd.html?id=1"><i
                        class="layui-icon">&#xe642;</i> </a>
                </td>
            </tr>
          
        </tbody>
    </table>
    
</body>
</html>